package com.baijia.common.enums;

/**
 * Created by dudu on 16/4/27.
 */
public enum UserRoleType {

    TEACHER(0, "老师"), STUDENT(2, "学生"), ORG(6, "机构"), ORG_TEACHER(10, "机构老师");

    private int id;
    private String name;

    private UserRoleType(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    };

    public void setName(String name) {
        this.name = name;
    }

    public static UserRoleType getById(int code) {
        for (UserRoleType userRoleType : UserRoleType.values()) {
            if (userRoleType.getId() == code) {
                return userRoleType;
            }
        }

        return null;
    }

}